#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'dengqianyi'


import socket
import time



# 缘分生成
def yuanfenshengcheng():
    msgList = ['''{"msgType":"FateGenerate","msgFunc":"shengchengyuanfen"}\n''',
               '''{"msgType":"FateGenerate","msgFunc":"shengchengchufaji"}\n''',
               '''{"msgType":"FateGenerate","msgFunc":"shengchengxml"}\n''',]
    HOST = '127.0.0.1'    # The remote host
    PORT = 8000           # The same port as used by the server
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST, PORT))

    for _index in xrange(0,len(msgList)):
        s.sendall(msgList[_index])
        print "one msg send begin"
        data = s.recv(1024)
        print data
    s.close()
    return True

# 神兵生成
def sbshengcheng():
    msgList = ['''{"msgType":"Shenbing","msgFunc":"shenbing_sgs_magic"}\n''',
               '''{"msgType":"Shenbing","msgFunc":"shenbing_sgs_magic_open_conf"}\n''',
               '''{"msgType":"Shenbing","msgFunc":"shenbing_sgs_magic_buff_conf"}\n''',
               '''{"msgType":"Shenbing","msgFunc":"shenbing_sgs_skill_advanced_conf"}\n''',
               '''{"msgType":"Shenbing","msgFunc":"shenbing_sgs_xml"}\n''']
    HOST = '127.0.0.1'    # The remote host
    PORT = 8000           # The same port as used by the server
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST, PORT))

    for _index in xrange(0,len(msgList)):
        s.sendall(msgList[_index])
        print "one msg send begin"
        data = s.recv(1024)
        print data
    s.close()
    return True

if __name__ == '__main__':
    yuanfenshengcheng()
    sbshengcheng()